﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace UM_SERVER.Command
{
    class BaseCommandParser : ICommandParser
    {
        #region ICommandParser 成员

        public bool Accpet(string command)
        {
            return Globle.commandHelper.GetCommandProtocol(command) == CommandProtocol.Protocol.PROTOCOL_NET;
        }

        public Command ParserCommand(string command)
        {
            BaseCommand baseCommand = new BaseCommand();
            baseCommand.Header = Globle.commandHelper.GetCommandHeader(command);
            baseCommand.Body = Globle.commandHelper.GetCommandBody(command);
            baseCommand.InputTime = DateTime.Parse(DateTime.Now.ToShortTimeString());
            baseCommand.Protocol = Globle.commandHelper.GetCommandProtocol(command);
            baseCommand.Args = Globle.commandHelper.GetCommandArgs(command);
            return baseCommand;
        }

        #endregion
    }
}
